import type { App, InjectionKey, Ref } from 'vue'
import { ref } from 'vue'

function titleProvide() {
  const title = ref('')
  const setTitle = (newTitle: string) => {
    title.value = newTitle
  }
  return {
    title,
    setTitle,
  }
}
export const TITLE = Symbol('title') as InjectionKey<{ title: Ref<string, string>, setTitle: (newTitle: string) => void }>
export default {
  install(app: App) {
    app.provide(TITLE, titleProvide())
  },
}
